package com.app.commands{
	import com.adobe.cairngorm.commands.ICommand;
	import com.adobe.cairngorm.control.CairngormEvent;
	import com.app.business.MahasiswaDelegate;
	import com.app.control.DoUpdateProfilMahasiswaEvent;
	import com.app.model.ModelLocator;
	import com.app.vo.MahasiswaVO;
	
	import mx.controls.Alert;
	import mx.rpc.IResponder;
	
	
	public class DoUpdateProfilMahasiswaCommand implements ICommand,IResponder{
		private var model:ModelLocator = ModelLocator.getInstance();
		public function execute(event:CairngormEvent):void{
			model.mahasiswa.isPending=true;
			var delegate:MahasiswaDelegate=new MahasiswaDelegate(this);
			var doUpdateMhs:DoUpdateProfilMahasiswaEvent = DoUpdateProfilMahasiswaEvent(event);
			delegate.doUpdateProfilMahasiswa(doUpdateMhs.mahasiswaVo);
		}
		public function result(data:Object):void{
			model.mahasiswa.isPending=false;
			model.mahasiswa.mahasiswaVo=MahasiswaVO(data);
			Alert.show('Profil Mahasiswa Berhasil Di Ubah');
		}
		public function fault(info:Object):void{
            Alert.show( "Profil Mahasiswa Gagal Di Ubah","Alert");
            model.dosen.isPending = false;
		}
	} 
}